import TimeUtil

if __name__ == '__main__':
    import pandas as pd

    # file = ""
    file = "D:\\中断输入\\输出\\2月单用户中断明细.csv"
    file2 = "D:\\中断输入\\输出\\3月单用户中断明细.csv"
    start = '2025-02-24'
    end = '2025-03-02'

    dfs = []
    if file:
        dfs.append(pd.read_csv(file,
                               dtype={
                                   5: str
                               }))
    if file2:
        dfs.append(pd.read_csv(file2,
                               dtype={
                                   5: str
                               }))
    df = pd.concat(dfs)
    print(len(df))
    # 筛选时间
    df['日期1'] = pd.to_datetime(df['日期'])
    date = pd.Timestamp(start)
    date2 = pd.Timestamp(end)
    df = df.loc[(df['日期1'] >= date) & (df['日期1'] <= date2)]
    start = TimeUtil.parse(start)
    end = TimeUtil.parse(end)
    del df['日期1']
    df.to_excel(f"D:\\中断输入\\新建文件夹\\{start.strftime('%m%d')}-{end.strftime('%m%d')}单用户中断明细.xlsx",
                index=False)
